//
//  JEmptyDataView.m
//  HeadIndustry
//
//  Created by jun on 2017/9/19.
//  Copyright © 2017年 jun. All rights reserved.
//

#import "JEmptyDataView.h"

@implementation JEmptyDataView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = [UIColor whiteColor];
        self.opaque = NO;
        [self setUpView];
    }
    return  self;
}

- (void)setUpView {

    //默认图片
    UIImageView *img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"order_empty"]];
    img.center = CGPointMake(kWindowW/2.0, kWindowH/2.0 - 120);
    img.bounds = CGRectMake(0, 0, 100, 100);
    img.tag = 20;
    [self addSubview:img];
    
    UILabel *warnLabel = [[UILabel alloc]init];
    warnLabel.center = CGPointMake(kWindowW/2.0, kWindowH/2.0 - 10);
    warnLabel.bounds = CGRectMake(0, 0, kWindowW, 60);
    warnLabel.textAlignment = NSTextAlignmentCenter;
    warnLabel.text = @"暂无相关商品！";
    warnLabel.numberOfLines = 0;
    warnLabel.tag = 10;
    warnLabel.font = [UIFont systemFontOfSize:16];
    warnLabel.textColor = kRGBColor(150, 150 , 150);
    [self addSubview:warnLabel];
}

- (void)setTitleStr:(NSString *)titleStr
{
    _titleStr = titleStr;
    UILabel *titleLabel = [self viewWithTag:10];
    titleLabel.text = titleStr;
}

- (void)setEmptyImgName:(NSString *)emptyImgName
{
    _emptyImgName = emptyImgName;
    UIImageView *img = [self viewWithTag:10];
    img.image = [UIImage imageNamed:emptyImgName];
}

@end
